#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
	int M, s;
	for (scanf("%d", &M); M--;) {
		scanf("%d", &s);
		int tot = 0;
		while (s)
			tot += s & 1, s >>= 1;
		printf("%d\n", tot);

	}
	return EXIT_SUCCESS;
}
